NVM.Filter = function () {
    var __core = NOVEM.Core;

    return {
        init: function (selector) {
            if (__core.getSelector(selector, false, false).length < 1) {
                return true;
            }

            __core.loadJS({ file: 'plugins/filtering.js', id: 'nvm-fliter-js', jsFolder: true });

            __core.isFuncTrue(function () {
                return typeof filteringjs !== 'undefined';
            }).then(function (cond) {
                if (!cond) {
                    return false;
                }

                __core.initFunction({ class: 'has-plugin-filter', event: 'pluginFilterReady' });

                selector = __core.getSelector(selector, false);
                if (selector.length < 1) {
                    return true;
                }

                const { FilteringFlow } = filteringjs;
                // new FilteringFlow(selector);
                // new FilteringFlow(selector[0]);
                selector.forEach(function (el) {
                    new FilteringFlow(el);
                });


            });
        }
    };
}();
